<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META NAME="Title" CONTENT="SMS Server Tools 3">
    <META NAME="Robots" CONTENT="INDEX,FOLLOW">
    <META NAME="Language" CONTENT="English">
    <title>SMS Server Tools 3</title>
<STYLE type="text/css">
BODY {
  BACKGROUND: #ffffff; MARGIN: 5px 5px 10px; FONT: 10pt verdana, geneva, lucida, arial, helvetica, sans-serif; COLOR: #000000
}
td {
  FONT: 10pt verdana, geneva, lucida, arial, helvetica, sans-serif;
}
h3 {
  background-color: #DCDCFE;
}
blockquote {
  background-color: #FFD;
  font-size: 90%;
  padding:5pt;
  padding-top:1pt;
  margin-bottom:5pt;
  border-style: outset;
  border-color: #aaaa99;
  border-width: 0.05pt 2pt 2pt 0.05pt;
}
blockquote p:first-letter {
  font-size: 110%;
  font-weight: bold;
  color: red;
}
</STYLE>
  </head>

<body>
<h2><font color=blue><a href="http://smstools3.kekekasvi.com">SMS Server Tools 3</a></font></h2>
<a href="index.html">Home</a>
<h3>User Data Header</h3>
<!-- START --><p>
<b>NOTE:</b> This text is about concatenated messages, as an example.
However, with SMSTools 3 you do not have to care about concatenation (multipart messages) while using settings
<i>autosplit = 3</i> for outgoing messages and <i>internal_combine = yes</i> for incoming messages.
These are default values.
<hr>
<p>
User Data header was added to the SMS format specification to add new features. 
Originally SMS was made to send single small binary files or text messages, with a maximum of 140 bytes or 160 7-bit characters. 
But now mobile devices need to distinguish between different files, for example ringtones, operator logos and wap-push messages. 
Also users want to send larger messages which was impossible with the original SMS format specification.
<p>
Each short message has a flag to indicate if the message part includes a User Data Header or not. 
If this flag is set to 1 (or true), then the first few bytes of the message are the User Data Header, 
followed by the message text or data. Example:
<p>
<table border=1 bgcolor=lightgrey><TR><TD>
<font face="Courier New, Courier, monospace">
From: 491721234567<br>
...<br>
<br>@$F%&amp;0_;Hello, this is my message to you...
</font>
</TD></TR></table>
<p>
When you receive a text message with User Data Header, you would normally see some scrambled characters at the beginning. 
Starting with version 2.1, smsd automatically removes these characters from the message text and shows them 
as a hex-dump in the sms file header. Example:
<p>
<table border=1 bgcolor=lightgrey><TR><TD>
<font face="Courier New, Courier, monospace">
From: 491721234567<br>
...<br>
UDH: true<br>
UDH-DATA: 05 00 03 5F 02 01<br>
<br>
Hello, this is my message to you...
</font>
</TD></TR></table>
<p>
Now you have a more beautiful text-part and the User Data Header is dumped into human readable format which 
makes reading it much easier. 
You might use the script <b>hex2dec</b> to convert the hexadecimal numbers to decimal.
<p>
The most popular use of User Data Headers are concatenated text messages. 
If somebody sends a text message that is longer than 160 characters, most phones splits the text 
automatically into two or more short messages. 
Each messages contains a header that is used by the receiving mobile phone to combine them in correct order.
<p>
Referring to the UDH-DATA in the above example, the 6 bytes have the following meaning:
<p>
05 = 5 bytes follow<br>
00 = indicator for concatenated message<br>
03 = three bytes follow<br>
5F = message identification. Each part has the same value here<br>
02 = the concatenated message has 2 parts<br>
01 = this is part 1
<p>
When you receive concatenated text messages, the parts might arrive in random order. 
You might first receive the last part and then the first part. 
The GSM specification does not force any device to transfer messages in the original order. 
So when you receive a concatenated message you need to check if all parts have been received before you 
can put all the parts together.
<p>
In case of binary messages, the header is part of the binary data and does not appear in the header, 
so you will not see any UDH-DATA header in binary message files.

<hr>
</body>
</html>
